package day1027.dem1.one;

/**
 * @program: fanxing
 * @description:
 * @author: 诸葛龙辰
 * @create: 2022-10-27 16:15
 **/
public class Frist {
    public static void main(String[] args) throws ClassNotFoundException {
        //1.通过类名来获取
        Class  rogClass = Rog.class;
        //2.通过对象获取对应的class对象
        Rog R = new Rog();
        Class aClass = R.getClass();
        //3.通过类名的全路径获取
        Class aCLass1 = Class.forName("day1027.dem1.one.Rog");
//这三个都是获取Dog类对应的反射类对象
        //class文件只会加载一次
        System.out.println(rogClass==aClass);
        System.out.println(rogClass==aCLass1);
        System.out.println(aClass==aCLass1);

    }
}
class Rog{
    private String name;
    private  Integer age;

    public void show(){
        System.out.println("show方法");
    }
    }

